package WrittenTest;

import java.util.*;

class Orange {
    int a = 0;
    int b = 0;

    public Orange() {
    }

    public Orange(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

public class test33 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), k = in.nextInt();
        Orange[] o = new Orange[n];
        for (int i = 0; i < n; i++) {
            o[i] = new Orange();
            o[i].a = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            o[i].b = in.nextInt();
        }
        Arrays.sort(o, (x, y) -> {
            if (x.b == y.b) {
                return x.a - y.a;
            } else {
                return y.b - x.b;
            }
        });
        long sums = 0, sumt = 0;
        for (int i = 0; i < k; i++) {
            sums += o[i].a;
            sumt += o[i].b;
        }
        System.out.print(sums + " " + sumt);
    }
}
